#include "stdafx.h"
#include "wf_layerstoggleview.h"

#include "pf_graphic.h"



WF_LayersToggleView::WF_LayersToggleView(
    PF_Container& container,
    PF_GraphicView& graphicView)
        :PF_ActionInterface("Toggle Layer Visibility",
                    container, graphicView) {}


QAction* WF_LayersToggleView::createGUIAction(LX_Define::ActionType /*type*/, QObject* /*parent*/) {
	// tr("Toggle Layer Visibility")
    QAction* action = new QAction(tr("&Toggle Layer"), NULL);
    //action->zetStatusTip(tr("Toggle Layer"));
	action->setIcon(QIcon(":/ui/layertoggle.png"));
    return action;
}

void WF_LayersToggleView::trigger() {
    PF_DEBUG->print("toggle layer");
    if (graphic!=NULL) {
        PF_Layer* layer = graphic->getActiveLayer();
        graphic->toggleLayer(layer);
    }
    finish();
}



void WF_LayersToggleView::init(int status) {
    PF_ActionInterface::init(status);
    trigger();
}

// EOF
